import http from '@/utils/http/axios';

/**
 * 获取支付宝认证请求
 */
export function alipayLogin() {
  return http.noAuthRequest({
    url: '/social/alipay/login',
    method: 'get',
  });
}

/**
 * 获取gitee认证请求
 */
export function giteeLogin() {
  return http.noAuthRequest({
    url: '/social/gitee/login',
    method: 'get',
  });
}

/**
 * 绑定账号信息
 * @param params
 */
export function relate(params) {
  return http.request({
    url: '/social/relate',
    method: 'post',
    params,
  });
}

/**
 * 获取token
 * @param tokenKey
 */
export function getToken(tokenKey) {
  return http.noAuthRequest({
    url: '/social/relate/getToken',
    method: 'get',
    params: { jwtKey: tokenKey },
  });
}

/**
 * 查询第三方账号绑定情况
 * @param username
 */
export function getRelateList(username) {
  return http.request({
    url: `/sys/relate/relateList/${username}`,
    method: 'get',
  });
}

/**
 * 解绑第三方登录
 * @param id
 */
export function unRelateSocial(id) {
  return http.request({
    url: `/sys/relate/unRelate/${id}`,
    method: 'post',
  });
}
